package cn.jdy.plugins.service;

import cn.jdy.framework.db.hibernate.BaseDao;
import cn.jdy.plugins.entity.District;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 行政区域
 * Created by Tianyi on 2015/6/6.
 */
@Service
public class DistrictService extends BaseDao<District> {

	public List<District> queryChildren(String parent) {
		List<District> list = super.find("parent", parent);
		if(list!=null && list.size()>0) {
			for(District temp : list) {
				super.hibernateTemplate.evict(temp);
				temp.setKeywords(temp.getId());
				temp.setId(temp.getName());
			}
		}
		return list;
	}
}
